home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 3 / Cream of the Crop 3.iso / comm / wnos5src.zip / SMTP.H < prev    next >
Text File  |  1993-09-19  |  3KB  |  128 lines

  1. #ifndef    _SMTP_H
  2. #define    _SMTP_H
  3.  
  4. /* Header types */
  5. #define    NOHEADER         -1
  6. #define APPROVED        0
  7. #define    FROM            1
  8. #define    TO                2
  9. #define    DATE            3
  10. #define    MSGID            4
  11. #define    SUBJECT            5
  12. #define    RECEIVED        6
  13. #define    SENDER            7
  14. #define    REPLYTO            8
  15. #define STATUS            9
  16. #define BBSTYPE            10
  17. #define XFORWARD        11
  18. #define CC                12
  19. #define RRECEIPT        13
  20. #define APPARTO            14
  21. #define ERRORSTO        15
  22. #define ORGANIZATION    16
  23. #define BULLID            17
  24. #define EXPIRE            18
  25. #define PATH            19
  26. #define NEWSGROUPS        20
  27. #define DISTRIBUTION    21
  28. #define    UNKNOWN            22
  29.  
  30. #define MAXSESSIONS    10        /* most connections allowed */
  31. #define JOBNAME        13        /* max size of a job name with null */
  32. #define    LINELEN        256
  33.  
  34. /* types of address used by smtp in an address list */
  35. typedef enum {
  36.     BADADDR     = 0,
  37.     LOCAL        = 1,
  38.     DOMAIN        = 2,
  39.     NNTP_GATE    = 3,
  40. } Mailtype;
  41.  
  42. /* a list entry */
  43. struct list {
  44.     struct list *next;
  45.     char *val;
  46.     Mailtype type;
  47. };
  48. #define    NULLLIST    (struct list *)0
  49.  
  50. /* Per-session control block  used by smtp server */
  51. struct smtpserv {
  52.     int s;                        /* the socket for this connection */
  53.     int states;                    /* status of server */
  54. #define OK        0
  55. #define PROMPT    1
  56. #define CLOSED    4
  57.     char *buf;                    /* input line buffer */
  58.     char *system;                /* Name of remote system */
  59.     char *from;                    /* sender address */
  60.     struct list *to;            /* Linked list of recipients */
  61.     FILE *data;                    /* Temporary input file pointer */
  62. };
  63. #define    NULLSMTPSV    (struct smtpserv *)0
  64.  
  65. /* used by smtpcli as a queue entry for a single message */
  66. struct smtp_job {
  67.     struct smtp_job *next;        /* pointer to next mail job for this system */
  68.     char jobname[9];            /* the prefix of the job file name */
  69.     long len;                   /* length of file */
  70.     char *from;                    /* address of sender */
  71.     struct list *to;            /* Linked list of recipients */
  72. };
  73. #define NULLJOB        (struct smtp_job *)0
  74.  
  75. /* control structure used by an smtp client session */
  76. struct smtpcli {
  77.     struct smtpcli *next;
  78.     int    s;                        /* connection socket */
  79.     int lock;                    /* In use */
  80.     int32 ipdest;                /* address of forwarding system */
  81.     char *destname;                /* domain address of forwarding system */
  82.     char *wname;                /* name of workfile */
  83.     char *tname;                /* name of data file */
  84.     char *buf;                    /* Output buffer */
  85.     char cnt;                    /* Length of input buffer */
  86.     FILE *tfile;
  87.     struct smtp_job *jobq;
  88.     struct list *errlog;
  89. };
  90. #define    NULLSMTPCLI    (struct smtpcli *)0
  91.  
  92. /* smtp server routing mode */
  93. #define ROUTE    0
  94. #define    QUEUE    1
  95.  
  96. /* smtp server delivering flags */
  97. #define BBS        1
  98. #define MAIL    2
  99. #define NEWS    4
  100.  
  101. extern char *Days[], *Months[], *Hdrs[];
  102.  
  103. extern int Smtpmode, Smtplzw, Smtpbbs;
  104. extern int16 Smtpquiet;
  105. extern int32 Gateway;
  106.  
  107. /* In smtpserv.c: */
  108. void smtpserv __ARGS((int s,void *unused,void *p));
  109. struct list *addlist __ARGS((struct list **head,char *val,int type));
  110.  
  111. /* In smtpcli.c: */
  112. int smtptick __ARGS((void *t));
  113.  
  114. /* in smtpsubr.c */
  115. int htype __ARGS((char *s));
  116. int32 mailroute __ARGS((char *dest));
  117. void del_list __ARGS((struct list *lp));
  118. char *rfc822_date __ARGS((int32 *t));
  119. long get_msgid __ARGS((void));
  120. char *getname __ARGS((char *cp));
  121. int validate_address __ARGS((char *s));
  122. struct list *expandalias __ARGS((struct list **head,char *user));
  123. int mailit __ARGS((FILE *data,char *from,struct list *tolist));
  124. int mdaemon __ARGS((FILE *data,char *to,struct list *lp,int bounce));
  125.  
  126. #endif    /* _SMTP_H */
  127.  
  128.